# $Id: PKGBUILD 79700 2012-11-11 10:30:00Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Timm Preetz <timm@preetz.us>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=avant-window-navigator
pkgver=0.4.0
pkgrel=13
pkgdesc="Fully customisable dock-like window navigator for GNOME"
arch=('i686' 'x86_64')
url="https://launchpad.net/awn"
license=('GPL')
depends=('libdesktop-agnostic' 'libwnck' 'libgtop' 'gconf' 'python2-dbus' 'pygtk' 'python2-xdg' 'hicolor-icon-theme' 'xdg-utils')
makedepends=('gtk-doc' 'vala' 'intltool')
options=('!libtool')
install=$pkgname.install
source=(http://launchpad.net/awn/0.4/$pkgver/+download/$pkgname-$pkgver.tar.gz
        688_687.diff
        821_820.diff
        824_823.diff)
md5sums=('03654b45dd95cbb83fa7e112bd00523c'
         '6b05ccb539f811729820d5545eb50d6e'
         '2cc0ecf9fccb6e559a98003715ebf6df'
         'd068c19503b7be1868bcce5dab003628')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # Fix uninitialised pointer
  # https://bugs.launchpad.net/awn/+bug/562499
  patch -Np0 -i "$srcdir/688_687.diff"

  # Remove bzr dependency
  # https://bugs.launchpad.net/awn/+bug/707863
  patch -Np0 -i "$srcdir/821_820.diff"

  # Hide windows with skip taskbar state
  # https://bugs.launchpad.net/awn/+bug/707863
  patch -Np0 -i "$srcdir/824_823.diff"

  # Python2 fix
  sed -i 's@^#!.*python$@#!/usr/bin/python2@' awn-settings/{awnSettings.py.in,awnSettingsHelper.py}
  sed -i 's/with ("python"/with ("python2"/' applet-activation/main.c

  autoreconf -fi
  ./configure --prefix=/usr --sysconfdir=/etc \
              --disable-static \
              PYTHON=/usr/bin/python2
  make
}

check() {
  cd "$srcdir/$pkgname-$pkgver"

  make check
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="$pkgdir" install

  install -m755 -d "$pkgdir/usr/share/gconf/schemas"
  gconf-merge-schema "$pkgdir/usr/share/gconf/schemas/awn.schemas" "$pkgdir"/etc/gconf/schemas/*.schemas
  rm -r "$pkgdir/etc"
}
